<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/7/22
  Time: 13:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script src="js/jquery-3.1.1.min.js"></script>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <h2>正在申请中,<span id="sp" style="color: orange">3</span>秒后回到主页</h2>

</body>
<script type="text/javascript">
    onload=function(){
        setInterval(go, 1000);
    };
    var x=3; //利用了全局变量来执行
    function go(){
        x--;
        if(x>0){
            $('#sp').html(x); //每次设置的x的值都不一样了。
        }else{
            location.href='http://localhost:8080/index.jsp';
        }
    }
</script>
</html>
